package com.cskaoyan.controller.admin.storageobject;

import com.cskaoyan.bean.MarketStorage;
import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.bean.vo.admin.storageobject.StorageObjectListVo;
import com.cskaoyan.service.admin.storageobject.StorageObjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: bwj
 * @Date: 2022/09/08/17:26
 * @Description:
 */
@RestController
@RequestMapping("admin/storage")
public class StorageObjectController {
    @Autowired
    StorageObjectService storageObjectService;

    @RequestMapping("list")
    public BaseRespVo<StorageObjectListVo> objectList(Integer page, Integer limit, String key, String name, String sort, String order){
        StorageObjectListVo objectListVo= storageObjectService.objectList(page,limit,key,name,sort,order);
        return BaseRespVo.ok(objectListVo);

    }

    /**
    * @Author: 宾文杰 @Description: 更新对象信息 @Date: 2022/9/8
    */
    @RequestMapping("update")
    public BaseRespVo<MarketStorage> objectUpdate(@RequestBody MarketStorage marketStorage){
        MarketStorage marketStorage1=storageObjectService.objectUpdate(marketStorage);
        return BaseRespVo.ok(marketStorage1);
    }

    /**
    * @Author: 宾文杰 @Description: 删除对象信息 @Date: 2022/9/8
    */
    @RequestMapping("delete")
    public BaseRespVo<String> objectDelete(@RequestBody MarketStorage marketStorage){
        storageObjectService.objectDelete(marketStorage);
        return BaseRespVo.ok(null);
    }
}
